import 'dart:ui';

import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/widgets.dart' hide Action,Page;
import 'package:hc_center/util/sp_utils.dart';

import 'action.dart';
import 'state.dart';

Reducer<AppGlobalState> buildReducer() {
  return asReducer(
    <Object, Reducer<AppGlobalState>>{
      AppGlobalAction.changeTheme: _onChangeTheme,
    },
  );
}

AppGlobalState _onChangeTheme(AppGlobalState state, Action action) {
  final int next = action.payload;
  SpUtils.putInt(SpUtils.themeColor, next);
  debugPrint('修改系统配色---$next');
  final AppGlobalState newState = state.clone();
  newState.themeColorIndex = next;
  return newState;
}


